<template>
  <div class="child">
    <h3>我是子组件,父组件的车是:{{ car }}</h3>
    <el-button type="Success" :icon="Plus" @click="handler">有钱了换个车</el-button>
  </div>
</template>

<script setup lang="ts">
import { Plus } from '@element-plus/icons-vue'

const props = defineProps(['car'])
const $emit = defineEmits(['changeCar'])

const handler = () => {
  $emit('changeCar', '宝马')
}
</script>

<style scoped>
.child {
  width: 300px;
  height: 300px;
  background: lightsalmon;
}
</style>
